/****************************************************************
** DTSTRUCT.H *
** 2010-03-10 *
****************************************************************/
#ifndef __DTSTRUCT_H_
#define __DTSTRUCT_H_
#include "System.h"

uint8_t GetChkSum_8(uint8_t *dptr, uint8_t len);
void mem_cpy (void* dst, const void* src, int cnt) ;
void mem_set (void* dst, int val, int cnt);
int mem_cmp (const void* dst, const void* src, int cnt);

/*****************************************************************
* DEFINE FIFO STRUCT
******************************************************************/
typedef struct {
    INT16U deepth;
    INT16U occupy;
    INT8U *array;
    INT8U *limit;
    INT8U *wp;
    INT8U *rp;
} FIFO;

#define LP_FIFO     FIFO


void InitFIFO(FIFO *fifo, INT8U *array, INT16U deepth);
void ResetFIFO(FIFO *fifo);
BOOLEAN WriteFIFO(FIFO *fifo, INT8U unit);
BOOLEAN WriteFIFOs(FIFO *fifo, INT8U *units, INT16U unitsize);
BOOLEAN FIFOEmpty(FIFO *fifo);
BOOLEAN FIFOFull(FIFO *fifo);
BOOLEAN ReadFIFO(FIFO *fifo, INT8U *ch) ;
BOOLEAN ReadFIFOs(FIFO *fifo, INT8U *pch, INT8U len);
BOOLEAN LocateFIFO(FIFO *fifo, INT16U offset);
BOOLEAN GetSeekFIFO(FIFO *fifo, INT16U offset, INT8U *ch);
INT8U FIFOSearchKeyWord(FIFO *fifo, char *sptr);
INT16U FIFOSpare(FIFO *fifo);
INT16U FIFOUsed(FIFO *fifo);

#endif

